﻿@model IEnumerable<FILSTARTUPS_CMS.Models.PageGrid>
@{
    ViewBag.Title = "Index";
}
@section Pagename
{
    <h2>
        Pages<small> Information</small></h2>
}

<script src="@Url.Content("~/Scripts/jquery.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {
        //        "{ 'query': '" + request.term + "' }",
        $('#query').autocomplete({
            source: function (request, response) {
     
                $.ajax({
                    url: '/Page/GetPageTitle',  
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    datatype: "json",
                    data: "{ query: '" + request.term + "'}",
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item, value: item };
                        }))
                    }
                });
            },
            minLenght: 2
        });
    });   
</script>
<!--- START PAGEINFO --->
@if (TempData["message"] != null)
{
    <div class="alert-message success  span12 left append-top" id="tempdata">
        <center>@TempData["message"]</center>
    </div>
}
<div class="row">
    <div class="span4">
 
        <h2>
            Create new Page</h2>
        <div class="createclass">@Html.ActionLink("Create Page", "Create", "Page")</div>
    
    </div>
    <div class="span10">
        @using (Ajax.BeginForm("SearchPage", "Page", new AjaxOptions
        {
            HttpMethod = "GET",
            UpdateTargetId = "pages",
            InsertionMode = InsertionMode.Replace
        }))
        {
          <fieldset>
                <legend>Search</legend>

            <input type="text" id="query" name="query" />
           <input type="submit" value="Filter" style="margin:5px;"/>
          </fieldset>
        }
        <div id="pages">
            @Html.Partial("_PageList")
        </div>
    </div>
</div>
@*<div id="tabs">
<ul>
@foreach (var item in Model)
{ 
    <li><a href="#@item.pageidPK">@item.Pagetitle</a></li>  
}
</ul>
@foreach (var item_ in Model)
{
    <div id="@item_.pageidPK">@Html.Raw(item_.Pagedescription)
      <div class="push-12 prepend-top">@Html.ActionLink("Edit", "Edit", new { id=item_.pageidPK })</div>
    </div>
  
}
</div>
*@
<!---END PAGE INFO --->
